//
//  CZVisitor.swift
//  sinaSwifWeiBo
//
//  Created by 张雪雪 on 16/2/25.
//  Copyright © 2016年 张雪雪. All rights reserved.
//

import UIKit


class CZVisitor: UIView {

//1.重写构造函数
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        backgroundColor = UIColor(white: 237/255, alpha: 1)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //2.创建一个私有方法来设置视图和约束
    private func setupUI(){
    
    //添加控件
        addSubview(homeIconImageView)
        
        //添加遮罩视图
        
        //addSubview(maskImageView)
        addSubview(iconImageView)
        addSubview(messageLable)
        addSubview(registerButton)
        addSubview(loginButton)
        
        //添加约束
        //转动动画居中对

        
        
    
    
    
    }
    
    
    
    //添加动画
    func startAnimation(){
    
    
    
    }
    
    
    func setInfo(message:String,image:String,animation:Bool){
    
        messageLable.text = message
    
    }
    
    
    //3.懒加载设置首页动图
    
    private lazy var homeIconImageView: UIImageView = {
    
        let img = UIImageView()
        
        //img.image = UIImageView(named: "visitordiscover_feed_image_smallicon")
        img.image = UIImage(named: "visitordiscover_feed_image_smallicon")
        
        return img
        
    }()
    
    //通用的图片
    private lazy var iconImageView: UIImageView = {
        
        let img = UIImageView()
        
        img.image = UIImage(named: "visitordiscover_feed_image_house")
        
        return img
        
    }()

    
    
    //提示语
    private lazy var messageLable : UILabel = {
    
        let label = UILabel()
        
        //设置属性
        label.font = UIFont.systemFontOfSize(14)
        
        label.textColor = UIColor.darkGrayColor()
        
        label.numberOfLines = 0
        
        label.textAlignment = .Center
        
        label.text = "关注一些人，回这里看看有什么惊喜"
    
        return label
    
    }()
    
    //注册按钮
    
    private lazy var registerButton : UIButton = {
        
        let button = UIButton(type: UIButtonType.Custom)
    
    button.setBackgroundImage(UIImage(named: "common_button_white_disable"), forState: UIControlState.Normal)
        
        
        button.setTitle("注册", forState: UIControlState.Normal)
        
        
        button.addTarget(self, action: "register", forControlEvents:UIControlEvents.TouchUpInside )
    
        
        return button
    }()
    //登陆
    private lazy var loginButton: UIButton = {
        
        let button = UIButton(type: UIButtonType.Custom)
        
        button.setBackgroundImage(UIImage(named: "common_button_white_disable"), forState: UIControlState.Normal)
        
        button.setTitle("登陆", forState: UIControlState.Normal)
        
        button.setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
        
        button.addTarget(self, action: "login", forControlEvents: UIControlEvents.TouchUpInside)
        
        
        return button
        
    }()
    
//遮罩视图
    private lazy var maskImageView:UIImageView = {
    
        let img = UIImageView()
        
        img.image = UIImage(named: "visitordiscover_feed_mask_smallicon")
        
        return img
    }()
    
    
}
